{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}

<h4>Add new UDF</h4>

<form class="form-horizontal">
  <div class="form-group">
    <label class="col-sm-2 control-label">UDF Name</label>
    <div class="col-sm-10">
      {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="UDF Name" value=udfName }}
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">UDF Class Name</label>
    <div class="col-sm-10">
      {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="UDF Class Name" value=udfClassName }}
    </div>
  </div>

  <div class="form-group">
    <label class="col-sm-2 control-label">File Resource</label>
    <div class="col-sm-10">
      {{#unless isAddingNewFileResource}}
        {{#power-select
        options=fileResourceList
        placeholder="File Resource"
        searchField="name"
        selected=selectedFileResource
        searchPlaceholder="Type the paramter"
        onchange=(action "handleFileResourceChange" ) as |filter| }}
          <b>{{filter.name}}</b>
        {{/power-select}}
      {{/unless}}
      {{#if isAddingNewFileResource}}

        <div class="form-group">
          <label class="col-sm-2 control-label">Resource name</label>
          <div class="col-sm-10">
            {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0"  placeholder="File Resource Name" value=resourceName }}
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-2 control-label">Resource Path</label>
          <div class="col-sm-10">
            {{input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0"  placeholder="File Resource path" value=resourcePath }}
          </div>
        </div>

      {{/if}}
    </div>
  </div>

  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button class="btn btn-success" type="button" {{action 'saveUDf'}}>Add UDF</button>
      <button class="btn btn-warning" type="button" {{action 'cancelSaveUDf'}}>Cancel</button>
    </div>
  </div>
</form>


{{yield}}
